﻿
#include "ZKFCTZ.h"
#include "../../../QuantyView3DView.h"
#include "afxdialogex.h"

using namespace DIO;

CString strktqbh;
CString strzkbh;
// ZKFCTZ 对话框


IMPLEMENT_DYNAMIC(ZKFCTZ, CDialogEx)

ZKFCTZ::ZKFCTZ(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_ZKFCTZ, pParent)
{

}

ZKFCTZ::~ZKFCTZ()
{
}

void ZKFCTZ::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	//DDX_Control(pDX, IDC_ZKFC_KTQBH, ZKFC_KTQBH);
	//DDX_Control(pDX, IDC_ZKFC_ZKBH, ZKFC_ZKBH);
	//DDX_Control(pDX, IDC_ZKFC_YCXH, ZKFC_YCXH);
	//DDX_Control(pDX, IDC_ZKFC_FCH, ZKFC_FCH);
	//DDX_Control(pDX, IDC_ZKFC_YSFCKS, ZKFC_YSFCKS);
	//DDX_Control(pDX, IDC_ZKFC_FCYXCD, ZKFC_FCYXCD);
	//DDX_Control(pDX, IDC_ZKFC_YSQM, ZKFC_YSQM);
	//DDX_Control(pDX, IDC_ZKFC_BZ, ZKFC_BZ);
	//DDX_Control(pDX, IDC_ZKFC_YCQJ, ZKFC_YCQJ);
	DDX_Control(pDX, IDC_ZKFC_LIST, ZKFC_LIST);
	DDX_Control(pDX, IDC_COMBO_ZKFCKTQBH, m_zkfcktqbh);
	DDX_Control(pDX, IDC_COMBO_ZKFCZKBH, m_zkfczkbh);
}


BEGIN_MESSAGE_MAP(ZKFCTZ, CDialogEx)

	ON_BN_CLICKED(IDC_ZKFC_ADD, &ZKFCTZ::OnBnClickedZkfcAdd)
	ON_CBN_SELCHANGE(IDC_COMBO_ZKFCKTQBH, &ZKFCTZ::OnCbnSelchangeComboZkfcktqbh)
	ON_CBN_SELCHANGE(IDC_COMBO_ZKFCZKBH, &ZKFCTZ::OnCbnSelchangeComboZkfczkbh)
	//ON_EN_CHANGE(IDC_ZKFC_YCXH, &ZKFCTZ::OnEnChangeZkfcYcxh)
END_MESSAGE_MAP()


// ZKFCTZ 消息处理程序

BOOL ZKFCTZ::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	// TODO:  在此添加额外的初始化
	CString TitleName;
	//TitleName =  "钻孔分层特征信息表";
	DWORD dwStyle = ZKFC_LIST.GetExtendedStyle();
	//dwStyle = ZKFC_LIST.GetExtendedStyle();
	ZKFC_LIST.SetExtendedStyle(dwStyle | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
	ZKFC_LIST.InsertColumn(0, _T("MDBTAD(勘探区编号)"), LVCFMT_CENTER, 70);
	ZKFC_LIST.InsertColumn(2, _T("GCJCBN(钻孔编号)"), LVCFMT_CENTER, 180);
	ZKFC_LIST.InsertColumn(3, _T("MDBRAA(岩层序号)"), LVCFMT_CENTER, 140);
	ZKFC_LIST.InsertColumn(4, _T("MDLOA(分层号)"), LVCFMT_CENTER, 140);
	ZKFC_LIST.InsertColumn(5, _T("MDLOA(分层号)"), LVCFMT_CENTER, 140);
	ZKFC_LIST.InsertColumn(6, _T("TKAJAM(分层岩芯长度)"), LVCFMT_CENTER, 140);
	ZKFC_LIST.InsertColumn(7, _T("YSEBZ(岩石全名)"), LVCFMT_CENTER, 140);
	ZKFC_LIST.InsertColumn(8, _T("MDLZZ(备注)"), LVCFMT_CENTER, 140);
	ZKFC_LIST.InsertColumn(9, _T("GCJLIJ(岩层倾角)"), LVCFMT_CENTER, 140);


	m_zkfcktqbh.AddString(TEXT("选择勘探区编号"));
	m_zkfcktqbh.SetCurSel(0);
	m_zkfcktqbh.AddString(TEXT("654324000000001"));
	//m_zkfcktqbh.AddString(TEXT("3"));

	m_zkfczkbh.AddString(TEXT("选择钻孔编号"));
	m_zkfczkbh.SetCurSel(0);
	m_zkfczkbh.AddString(TEXT("JZK1306"));
	m_zkfczkbh.AddString(TEXT("ZK0103"));
	m_zkfczkbh.AddString(TEXT("ZK0104"));
	m_zkfczkbh.AddString(TEXT("ZK0105"));
	m_zkfczkbh.AddString(TEXT("JZK106"));
	m_zkfczkbh.AddString(TEXT("ZK0107"));
	m_zkfczkbh.AddString(TEXT("ZK0108"));
	m_zkfczkbh.AddString(TEXT("ZK0109"));

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}




void ZKFCTZ::OnCbnSelchangeComboZkfcktqbh()
{
	// TODO: 在此添加控件通知处理程序代码
	//获取某个索引
	int index = m_zkfcktqbh.GetCurSel();
	//获得勘探区编号
	m_zkfcktqbh.GetLBText(index, strktqbh);
}


void ZKFCTZ::OnCbnSelchangeComboZkfczkbh()
{
	// TODO: 在此添加控件通知处理程序代码
	//获取某个索引
	int index = m_zkfczkbh.GetCurSel();
	//获得勘探区编号
	m_zkfczkbh.GetLBText(index, strzkbh);
}


void ZKFCTZ::OnBnClickedZkfcAdd()
{
	// TODO: 在此添加控件通知处理程序代码
	DrillFloor_ST drill;

	CString ZKFCTZ_ktqbh;
	//GetDlgItem(IDC_ZKFC_KTQBH)->GetWindowText(strktqbh);
	drill.kantanqu_no = strktqbh;

	CString ZKFCTZ_zkbh;
	//GetDlgItem(IDC_ZKFC_ZKBH)->GetWindowText(strzkbh);
	drill.drill_no = strzkbh;

	CString ZKFCTZ_ycxh;
	GetDlgItem(IDC_ZKFC_YCXH)->GetWindowText(ZKFCTZ_ycxh);
	drill.rock_no = ZKFCTZ_ycxh;

	CString ZKFCTZ_fch;
	GetDlgItem(IDC_ZKFC_FCH)->GetWindowText(ZKFCTZ_fch);
	drill.fenceng_no = ZKFCTZ_fch;

	CString ZKFCTZ_ysfcks;
	GetDlgItem(IDC_ZKFC_YSFCKS)->GetWindowText(ZKFCTZ_ysfcks);
	double rockdepth = atof(ZKFCTZ_ysfcks);
	drill.rockdepth = rockdepth;

	CString ZKFCTZ_fcyxcd;
	GetDlgItem(IDC_ZKFC_FCYXCD)->GetWindowText(ZKFCTZ_fcyxcd);
	double rockcoredepth = atof(ZKFCTZ_fcyxcd);
	drill.rockcoredepth= rockcoredepth;

	CString ZKFCTZ_ysqm;
	GetDlgItem(IDC_ZKFC_YSQM)->GetWindowText(ZKFCTZ_ysqm);
	double rockname = atof(ZKFCTZ_ysqm);
	drill.rockname = rockname;

	CString ZKFCTZ_bz;
	GetDlgItem(IDC_ZKFC_BZ)->GetWindowText(ZKFCTZ_bz);
	drill.note = ZKFCTZ_bz;

	CString ZKFCTZ_ycqj;
	GetDlgItem(IDC_ZKFC_YCQJ)->GetWindowText(ZKFCTZ_ycqj);
	double deepth = atof(ZKFCTZ_ycqj);
	drill.rockangle = deepth;

	int nindex = ZKFC_LIST.InsertItem(1, ZKFCTZ_ycxh);
	//ZKFC_LIST.SetItemText(nindex, 1, ZKFCTZ_zkbh);
	ZKFC_LIST.SetItemText(nindex, 1, ZKFCTZ_fch);
	ZKFC_LIST.SetItemText(nindex, 2, ZKFCTZ_ysfcks);
	ZKFC_LIST.SetItemText(nindex, 3, ZKFCTZ_fcyxcd);
	ZKFC_LIST.SetItemText(nindex, 4, ZKFCTZ_ysqm);
	ZKFC_LIST.SetItemText(nindex, 5, ZKFCTZ_bz);
	ZKFC_LIST.SetItemText(nindex, 6, ZKFCTZ_ycqj);

	UserInsertDMZK0402(drill);
}




